package Test1;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class SimpleDateFormatDemo2 {
    public static void main(String[] args) throws ParseException {
        String str = "2023-11-11 11:11:11";
        //创建对象格式与字符串格式一样
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = sdf.parse(str);

        System.out.println(date);

        System.out.println(date.getTime());
    }
}
